<?php

class m130111_093417_employee_project extends CDbMigration
{
	public function safeUp()
	{
		$this->addColumn('erp_employee', 'currentProjectId', 'int');
		$this
		->createIndex("employee_current_project_id", 'erp_employee', 'currentProjectId');
		$this
		->addForeignKey('fk_employee_current_project_id', 'erp_employee',
			'currentProjectId', 'erp_project', 'id', 'SET NULL', 'CASCADE');

		$this->addColumn('erp_project', 'status', 'int not null');
	}

	public function safeDown()
	{
		$this->dropColumn('erp_project', 'status');
		
		$this->dropForeignKey('fk_employee_current_project_id', 'erp_employee');
		$this->dropIndex("employee_current_project_id", 'erp_employee');
		$this->dropColumn('erp_employee', 'currentProjectId');
	}
}